﻿<%--<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Import Namespace="OAclient.Common" %>--%>
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%--<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>

<script src="../../Scripts/fckeditor/ckfinder/ckfinder.js" type="text/javascript"></script>

<script src="../../Scripts/fckeditor/ckeditor/ckeditor.js" type="text/javascript"></script>

<script src="../../Scripts/fckeditor/ckeditor/adapters/jquery.js" type="text/javascript"></script>
--%>

<script type="text/javascript">
    $(function() {
        $.ajax({
            type: 'POST',
            url: '/Gzzd/Select',
            data: {},
            success: function(contents) {
                // alert(contents);
                $('#imtest1').attr("innerHTML", contents);
            }
        });
    });


</script>

<script type="text/javascript">

    $(function() {
        $.ajax({
            type: 'POST',
            url: '/Gzzd/ReturnDetail',
            data: {},
            success: function(contents) {
                //alert(contents);
                editor.setData(contents);
                //                $('#fckeditor').attr(contents);s
            }
        });
    });
</script>

<div style="padding-top: 35px;">
    <div id="GzzdDetail">
        <span id="imtest1"></span>
    </div>
    <div id="GzzdAmend">
        <div>
            <p>
                修改规章制度内容:</p>
        </div>
        <div>
            <textarea id="fckeditor" name="fckeditor" cols="50" rows="2"></textarea>

            <script type="text/javascript">

                var editor;

                // 防止二次replace同一个实例失败
                if (CKEDITOR.instances['fckeditor']) {
                    CKEDITOR.remove(CKEDITOR.instances['fckeditor']);
                }
                editor = CKEDITOR.replace('fckeditor');
                CKFinder.setupCKEditor(editor, 'Scripts/fckeditor/ckfinder/');

                function alertfck() {
                    var data = CKEDITOR.tools.htmlEncode(editor.getData());
                    var text = editor.document.getBody().getText();
                    $.ajax({
                        type: 'POST',
                        url: '/Gzzd/Submit',
                        data: { Fckcontext: data, Fckcontext2: text },
                        success: function(contents) {
                            editor.setData(contents);
                            $('#imtest1').attr("innerHTML", contents);
                        }
                    });
                }
            </script>

            <%--<%=Html.Partial("Fckeditor") %>--%>
            <%-- <input type="text" id="gzzd_detail" name="gzzd_detail" />--%>
        </div>
        <div>
            <input type="button" id="sure" value="确认修改并保存" onclick="alertfck()" />
        </div>
    </div>
</div>
